<?php
namespace app\mobile\controller;

use app\model\Record; 
use app\model\Util; 
use app\model\Comm; 
use app\model\Theme; 
use app\model\Worker; 

class Getbaseyx2020 extends Base
{
    public function Getbaseyx2020()
    {
global $_G, $_P;
// $fans = $this->checkuser();

$system=$_G['system'];
$themeid = intval($_P['themeid']);
if($themeid < 0){
	return_msg('活动入口不正确');
}
$theme = Theme::getThemeById($themeid);
if(empty($theme['id'])){
    die(Util::showError("请确认活动地址是否正确"));
    return;
}
$config = 	Theme::getConfig($themeid);

if (empty($system['endday'])) {
	$endday = 5;
}else{
	$endday = $system['endday'];
}
$endday = $endday*24*3600;


$themyrecordid = $_P['myid'];
$mytype = $_P['mytype'];
$nowgroupneednum = $_P['neednum'];
if (!empty($_P['record'])) {
	$showrecord = Record::getAttendGroupById($_P['record']);;
}
if ($config['joinfee']=='0.00' && $config['groupprice']=='0.00'){
	if ($config['touxiang']==2) {
		$config['touxiang']=1;
	}
}

$workerid = $_P['workerid'];
$theyworker = Worker::getThemeWorkerByUid($workerid,$themeid,1);
$workername = $theyworker['username'];
$workermobile = $theyworker['mobile'];
$company = $theyworker['company'];
$workerqr = $theyworker['qrcode']; 

$myworker = Worker::getThemeWorkerByOpenid($_G['openid'],$themeid,1);
$groupsnum = Record::getFansNumByThemeId($themeid,$config['showalldata']);
$groupsnum = intval($groupsnum)+intval($config['faketuan']);;
$scannum = Record::getscannumByThemeId($themeid,$config['showalldata'])+intval($config['fakescan']);
$total1 = Record::getNumByThemeId($themeid,$config['touxiang'],$config['showalldata']);
$totalsum = $total1 + $config['fakejoin'];
$tuanrenshu = $config['maxcount']+1;

if(!empty($showrecord)){
    $count = Record::getAttendDetailNumByPId($showrecord['id']);
	if($count > 0){
		$detaillist = Record::getDetailListByPid($showrecord['id']);
		foreach($detaillist as $index =>$row){
			if($row['openid'] == $_G['openid']){
				$isdetail = 1;
				break;
			}
		}
	} 

    if ($showrecord['renshu'] == 1) {
        $groupprice = $config['groupprice2'];
        $maxcount = $config['maxcountall2']-1;
        $maxcountall = $config['maxcountall2'];
    }else{
        $groupprice = $config['groupprice'];
        $maxcount = $config['maxcount'];
        $maxcountall = $config['maxcountall'];
    }

	$nowgroupneednum=max(0,$maxcount-$count);

    if ($showrecord['xunifinish']==1) {
    	$kaishishu = $showrecord['uid'] % 500;
		$xunisql = "SELECT avatar,username FROM " . tablename('2019xuni_fans') . " where
			 id >". $kaishishu ." limit ".$nowgroupneednum;
		$xunilist = db_select ( $xunisql );
		if (!empty($detaillist)) {
			$detaillist = array_merge($detaillist , $xunilist);
		}else{
			$detaillist = $xunilist;
		}

    	$nowgroupneednum=0;
    }else{
		$num_arr = array();
		if ($config['maxcountall']<=20){
		  	for($i=0;$i<$nowgroupneednum;$i++){
		  		$num_arr[$i] = $i; 
		  	}
	  	}
  	}
}
if (!empty($config['renshu'])){
	if($theme['status'] == 2 && $config['renshumode']==1){
		$totalsum = $config['renshu'];
	}
}
if ($config['iswttouxiang']!=10){
	$txt =  "<div class=\"orderNum\">\n";
	if ($config['iswttouxiang']==1){
		$txt .=  "   <div class=\"orderBox\" style=\"text-align: center;\">\n";
		$txt .=  "       <h2 style=\"float: none;\"><span>" . $scannum . "</span>人访问浏览</h2>\n";
	}else{
		$txt .=  "   <div class=\"orderBox\">\n";
		$txt .=  "       <h2><span>" . $totalsum . "</span>人参加报名</h2>\n";
		$txt .=  "       <div class=\"inforNum\">\n";
		$txt .=  "           <p>浏览量".$scannum ."</p>\n";
		$txt .=  "           <span>已有".$groupsnum."人参与</span>\n";
		$txt .=  "       </div>\n";
	}
	$txt .=  "   </div>\n";
	$txt .=  "   <div class=\"boderLine\"></div>\n";
	$txt .=  "</div>\n";
	$result['ordernum'] = Theme::encode($txt);
}

if ($config['istime']!=10){
	if ($theme['status']==2 || $theme['endtime'] < TIMESTAMP){
		$theme['endtime']=TIMESTAMP;
	}

	$txt = "";// "<img class=\"pos1\" src=\"" . $_G['URL']['YX2020_CSS'] ."images/art1.png\">\n";
	$txt .=  "<div class=\"orderTit\">\n";
	$txt .=  "   <img src=\"" . $_G['URL']['YX2020_CSS'] ."images/tit.png\"> \n";
	$txt .=  "   <div class=\"lxftime\" endtime=\"". date('m/d/Y H:i:s',$theme['endtime']) ."\"></div>\n";
	$txt .=  "</div>\n";
	$result['showtime'] = Theme::encode($txt);
}


if ($config['iswttouxiang']!=10){
		    $scannum = Record::getscannumByThemeId($themeid,$config['showalldata'])+intval($config['fakescan']);
		    $numarray = str_split($totalsum.'');
			if ($system['softstyle']==6){
				$txnum = 42;
			}else{
				$txnum = 105;
			}
			//参加人数
			if (!(($fans['status']==2 || ($theme['endtime']+$endday) < TIMESTAMP) && $system['s']['istouxiang']==1)) {
				if ($system['softstyle']==6){
					$fanslist = Record::getFanslistByThemeIdjm($themeid,$config['touxiang'],$txnum);
				}else{
					$fanslist = Record::getFanslistByThemeId($themeid,$config['touxiang'],$txnum,$config['showalldata']);
				}
			}else{
				$fanslist= array();
			}
			//虚拟头像
			if (count($fanslist)<$txnum && $config['fakejoin']>0){
				$tempcount = $txnum-count($fanslist);
				if ($tempcount > $config['fakejoin']){
					$tempcount = $config['fakejoin'];
				}
				if (strstr($config['softtag0'],"婚纱")!==false ){
					$kaishishu = intval( substr(MODULE_NAME, -1))%10*20+700;
				}else{
					$kaishishu = intval( substr(MODULE_NAME, -1))%10*50;
				}
				if ($config['touxiang']==0){
					$xunisql = "SELECT nickname as username,avatar FROM " . tablename('2019xuni_fans') . " where
					 id >". $kaishishu ." limit ".$tempcount;
				}else{
					$xunisql = "SELECT username,avatar FROM " . tablename('2019xuni_fans') . " where
					 id >". $kaishishu ." limit ".$tempcount;
				}
				$xunilist = db_select ( $xunisql );
				if ($system['softstyle']!=6){
					$fanslist = array_merge($fanslist , $xunilist);
				}
			}
			//隐藏客户真实姓名
			if ($config['touxiang']>0 && $config['isshowname']==1 ){
				foreach ($fanslist as $index => $row){
					$usernamelen=mb_strlen($row['username'],'utf-8');
					if ($usernamelen > 2){
						$fanslist[$index]['username']=mb_substr($row['username'],0,1,'utf-8').'*'.mb_substr($row['username'],$usernamelen-1,1,'utf-8');
					}elseif (!empty($row['username'])){
						$fanslist[$index]['username']='*'.mb_substr($row['username'],-1,1,'utf-8');
					}
			    }
			}

	$txt =  "<div class=\"orderPeo\">\n";
	$txt .=  "   <div class=\"orderSlide\">\n";
	$txt .=  "       \n";
	$txt .=  "       <div class=\"content baoming_head\">\n";
	$txt .=  "   <div class=\"content\">\n";
	$txt .=  "     <ul class=\"content\" id=\"get_clone\">\n";
	if (!empty($fanslist)) {
		foreach ($fanslist as $index => $item) {
			$txt .=  "<li><img src=\"" . tomedia($item['avatar']) . "\"><br>";
			if (empty($item['username'])){
				$txt .=  "null";
			}else{
				$txt .=  mb_substr($item['username'],0,3,'utf-8');
			}
			$txt .=  "</li>\n";
		}
	}
	$txt .=  "         </ul>\n";
	$txt .=  "   </div>\n";
	$txt .=  " </div>\n";
	$txt .=  "   </div>\n";
	$txt .=  "   <div class=\"boderLine2\"></div>\n";
	$txt .=  "   <div class=\"boderLine3\"></div>\n";
	$txt .=  "</div>\n";
	$result['headlist'] = Theme::encode($txt);
}

if (!empty($config['renshu'])){
	$jindu = round(100*$totalsum/$config['renshu'],2);
	if($jindu > 100){
		$jindu = 100;
	}

	if ($config['renshumode']==1) {
		$jindu = 100-$jindu;
	}
	if ($config['renshumode']==1 || $config['renshumode']==2) {
		if ($totalsum>=$config['renshu']) {
		    db_update(t_theme, array("status"=>2), array('id' => $themeid));
		    $theme['status'] = 2;
		}
	}

	$txt =  " <div class=\"jdBox\">\n";
	$txt .=  " 	  <div class=\"jdbar\">\n";
	if ($jindu>0 && $jindu<3) {
		$jdimg =10;
		$jindu = $jindu+2;
	}elseif ($jindu<15) {
		$jdimg =10;
	}elseif ($jindu<30) {
		$jdimg =25;
	}elseif ($jindu<60) {
		$jdimg =50;
	}elseif ($jindu<85) {
		$jdimg =75;
	}elseif ($jindu<=100) {
		$jdimg =100;
	}

	$txt .=  "     	 <span class=\"jdtiao\" style=\"background: url(" . $_G['URL']['YX2020_CSS'] ."images/linght" . $jdimg .".png) center no-repeat;width:" . $jindu . "%;background-size: 100% 100%;\"></span>\n";
	$txt .=  "        <span class=\"noticeTag\"><i>" . $config['renshu'] . "</i>" . $config['renshudanwei'] . "</span>\n";
	$txt .=  "     </div>\n";
	$txt .=  "     <div class=\"jdNotice\">\n";
	if (empty($config['renshutips'])) {
		if ($config['renshumode']==0 || $config['renshumode']==2) {
			$config['renshutips'] = "限量#renshu个名额，已报名#baoming人";
		}else{
			$config['renshutips'] = "限量#renshu个名额，还剩余#shengyu个名额";
		}
	}

	$shengyu = $config['renshu'] - $totalsum;
	if ($shengyu< 0 ){$shengyu = 0;}
	$config['renshutips'] = str_replace("#renshu", $config['renshu'], $config['renshutips']);
	$config['renshutips'] = str_replace("#baoming", $totalsum, $config['renshutips']);
	$config['renshutips'] = str_replace("#shengyu", $shengyu, $config['renshutips']);

	$txt .=  $config['renshutips'] . "</span>\n";
	$txt .=  "     </div>\n";
	$txt .=  "     </div>\n";
	$result['jdBox'] = Theme::encode($txt);
}


if ($config['maxcount']>0) {
if (!empty($showrecord) && $system['softstyle']!=7){
	$txt =  " <div class=\"pin\">\n";
	$txt .=  " 	<ul>\n";
	$txt .= "                     <li>\n";
	$txt .= "                         <img src=\"" . tomedia($showrecord['avatar']) ."\">\n";
	$txt .= "                         <span class=\"homez\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/homez.png \"></span>\n";
	$txt .= "                     </li>\n";

	if (!empty($detaillist)){
		foreach ($detaillist as $cindexno => $item) {
		$txt .= "                     <li>\n";
		$txt .= "                         <img src=\"" . tomedia($item['avatar']) . "\">\n";
		if ($cindexno==0){
			$txt .= "                         <span class=\"bbsoft\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/soft.png\"></span>\n";
		}
		$txt .= "                     </li>\n";
	    
		}
    }
	if (!empty($num_arr)){
		foreach ($num_arr as $cindexno => $item) {
		$txt .= "                     <li>\n";
		$txt .= "                         <img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/ask.png\">\n";
		$txt .= "                     </li>\n";
	    
		}
    }
    // 
	$txt .=  "   </ul>\n";
	if (empty($themyrecordid)){
		$txt .=  "   <a href=\"javascript:;\" onclick=\"show_info(2)\"  class=\"subBtn\">";
		if ($nowgroupneednum!=0){
			$txt .= "还差<span>" . $nowgroupneednum . "</span>人 立即加入";

		}else{
			if ($config['maxcountall']>1){
				if ($config['tuanmode']==0){
					$txt .= "          — 已拼成功 —\n";
				}else{
					$txt .= "          — 已拼成,还可继续加入,共享福利 —\n";
				}
			}
		}
	}else{
		$txt .=  "   <a href=\"javascript:;\" onclick=\"letgo1()\" class=\"subBtn\">";
		if ($nowgroupneednum!=0){
			$txt .= "还差<span>" . $nowgroupneednum . "</span>人 立即邀请好友";

		}else{
			if ($config['maxcountall']>1){
				if ($config['tuanmode']==0){
					$txt .= "          — 已拼成功 —\n";
				}else{
					$txt .= "          — 已拼成,还可继续加入,共享福利 —\n";
				}
			}
		}
	}
	$txt .= "</a>\n";
	$txt .=  " </div>\n";
	$result['pin'] = Theme::encode($txt);
}
}
if (empty($themyrecordid) && $config['isrecent']==1){
	$recentlist = Record::getPayEdListByThemeIding($themeid,5);
	foreach ($recentlist as $index =>$row){
		if ($row['renshu'] == 1) {
        	$neednum = $config['maxcountall2'];
		}else{
        	$neednum = $config['maxcount']+1;
		}		

        $details = Record::getAttendDetailNumByPId($row['id'])+1;
        $recentlist[$index]['details']  = $details;
        $recentlist[$index]['neednum'] = $neednum;
        $leftnum = $neednum-$details;
        $recentlist[$index]['leftnum'] = $leftnum < 0?0:$leftnum;
        if($neednum<= 0){
            $neednum = 1;
        }
        $percent = round(floatval($details*100/$neednum),2);
        $recentlist[$index]['percent']  = $percent;
        
		if ($config['isshowname']==1 ){
			$usernamelen=mb_strlen($row['username'],'utf-8');
			if ($usernamelen > 2){
				$recentlist[$index]['username']=mb_substr($row['username'],0,1,'utf-8').'*'.mb_substr($row['username'],$usernamelen-1,1,'utf-8');
			}elseif (!empty($row['username'])){
				$recentlist[$index]['username']='*'.mb_substr($row['username'],-1,1,'utf-8');
			}
		}
    }
    if (!empty($recentlist)) {
		$txt =  "<div class=\"team\">\n";
		$txt .=  "   <div class=\"teamTit\">\n";
		$txt .=  "       <img src=\"" . $_G['URL']['YX2020_CSS'] ."images/titimg3.png\">\n";
		$txt .=  "   </div>\n";
		$txt .=  "   <div class=\"xsj\">\n";
		$txt .=  "       <img src=\"" . $_G['URL']['YX2020_CSS'] ."images/xsj.jpg\">\n";
		$txt .=  "   </div>\n";
		$txt .=  "   <div class=\"teamList\">\n";
		$txt .=  "       <div class=\"titline\"><span></span>您可以直接参与<span></span></div>\n";
		$txt .=  "       <ul>\n";
		foreach ($recentlist as $key => $item) {
			$txt .=  "           <li>\n";
			$txt .=  "               <div class=\"teamImg\"><img src=\"" . $item['avatar'] . "\"></div>\n";
			$txt .=  "               <p class=\"nameBox\">" . $item['username'] . "</p>\n";
			$txt .=  "               <div class=\"jdt\">\n";
			$txt .=  "                   <span style=\"width:" . $item['percent'] . "%\"></span>\n";
			$txt .=  "               </div>\n";
			$txt .=  "               <div class=\"peoNumber\"><span>" . $item['details'] . "</span>/" . $item['neednum'] ."</div>\n";
			$txt .=  "               <a href=\"";
			if (!empty($themyrecordid)) {
				$txt .=  "#";
			}else{
				$txt .=  "/" . createMobileUrl("index",array("themeid"=>$item["themeid"],"fromuid"=>$fromuid,"fopenid"=>$fopenid,"workerid"=>$workerid,"recordid"=>$item["id"],"showtuan"=>1));
			}
			$txt .=  "\">去拼单</span></a>\n";
			$txt .=  "           </li>\n";
		}
		$txt .=  "       </ul>\n";
		$txt .=  "   </div>\n";
		$txt .=  "</div>\n";

		$result['isrecent'] = Theme::encode($txt);
    }
}

if($config['iscomm']==1){

	//屏蔽转发红包与摇一摇红包
	if($config['iscomm']==1 && ($system['fenxiao07']==1 || $config['comm41'] > 0) && !empty($workerid)){

		if (empty($theyworker) || $theyworker['comm4status']>1){
			$system['fenxiao07']=0;
			$config['comm41'] = 0;
		}
	}

	//如果只开启了员工,前台不显示排行和图标
	if ($system['fenxiao01'] >0 || $system['fenxiao04'] ==1 || $system['fenxiao05'] ==1 || $system['fenxiao07'] ==1){
		$commssum = Comm::getcommssum($system,$themeid,$config['iscommshowfail']);
        $commresult = Comm::getcommslist($system,$config,$themeid);
        $commslist = $commresult['commslist'];
        $commslisttoday = $commresult['commslisttoday'];
		$result['fenxiaotip'] = Theme::encode($commresult['fenxiaotip']);
	}

	$txt =  "";
	if (!empty($config['commlistimgbg'])) {
		$txt .=  "<style type=\"text/css\"> .phb{ background: url('" .$config['commlistimgbg']."') center top no-repeat;} </style>";
	}

	$txt .=  " <div class=\"phb\">\n";
	$txt .=  " 	 <div class=\"phbtitle\">\n";
	if (empty($config['commlistimg'])) {
		$txt .=  "    	<img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/phb.png\">\n";
	}else{
		$txt .=  "    	<img src=\"" . $config['commlistimg'] . "\">\n";
	}
	$txt .=  " </div>\n";
	$txt .=  " <div class=\"phbBar\">\n";
	$txt .=  "    <!-- <div class=\"titImg\">\n";
	$txt .=  "       <img src=\"" .$_G['URL']['YX2020_CSS']."images/titimg.png\">\n";
	$txt .=  "    </div> -->\n";

	if ($config['iscommshow24']==1){
		$txt .=  "    <div class=\"chosB\">\n";
		$txt .=  "       <span id='chosphbA' class=\"on2\" onclick=\"chosphbA()\">总&#25490;行&#27036;</span>\n";
		$txt .=  "       <span id='chosphbB' onclick=\"chosphbB()\">24小时&#25490;行&#27036;</span>\n";
		$txt .=  "    </div>\n";
	}
	$txt .=  "    <div class=\"tableBox\">\n";
	$txt .=  "       <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
	$txt .=  "           <tbody><tr>\n";
	$txt .=  "               <th>&#25490;&#21517;</th>\n";
	$txt .=  "               <th>&#23458;&#25143;&#20449;&#24687;</th>\n";
	if ($config['isrankrenshu']==0){
	$txt .=  "               <th>&#25968;&#37327;</th>\n";
	}
	if ($config['isrankqianshu']==0){
	$txt .=  "               <th>&#37329;&#39069;</th>\n";
	}
	$txt .=  "           </tr>\n";

	if (!empty($commslist)) {
		foreach ($commslist as $cindexno => $row) {
			$cindex = $cindexno + 1;
			$txt .=  "           <tr>\n";
			if ($cindex<4){
				$txt .=  "           	<td><img src=\"" . $_G['URL']['YX2020_CSS'] . "images/icon1" . $cindex . ".png\"></td>\n";
			}else{
				$txt .=  "           	<td>" . $cindex . "</td>\n";
			}
			$txt .=  "               <td style=\"text-align:left;\"><img src=\"" . tomedia($row['avatar']) . "\" class=\"baby\">";
			if (empty($row['nickname'])){
				$txt .=  "null" . $row['uid'];
			}else{
				$txt .=  mb_substr($row['nickname'],0,8,'utf-8');
			}
			$txt .=  "</td>\n";
			if ($config['isrankrenshu']==0){
				$txt .=  "               <td>" . $row['commcount'] . "人</td>\n";
			}
			if ($config['isrankqianshu']==0){
				$txt .=  "               <td><span>￥" . $row['feesum'] ."</span></td>\n";
			}
			$txt .=  "           </tr>\n";
		}
	}
	$txt .=  "       </tbody></table>\n";
	$txt .=  "       <table width=\"100%\" class=\"dn\" cellpadding=\"0\" cellspacing=\"0\">\n";
	$txt .=  "           <tbody><tr>\n";
	$txt .=  "               <th>排名</th>\n";
	$txt .=  "               <th>客户信息</th>\n";
	if ($config['isrankrenshu']==0){
	$txt .=  "               <th>数量</th>\n";
	}
	if ($config['isrankqianshu']==0){
	$txt .=  "               <th>金额</th>\n";
	}
	$txt .=  "           </tr>\n";
	if (!empty($commslisttoday)) {
		foreach ($commslisttoday as $cindexno => $row) {
			$cindex = $cindexno + 1;
			$txt .=  "           <tr>\n";
			if ($cindex<4){
				$txt .=  "           	<td><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/icon1" . $cindex . ".png\"></td>\n";
			}else{
				$txt .=  "           	<td>" . $cindex . "</td>\n";
			}
			$txt .=  "               <td style=\"text-align:left;\"><img src=\"" . tomedia($row['avatar']) . "\" class=\"baby\">";
			if (empty($row['nickname'])){
				$txt .=  "null" . $row['uid'];
			}else{
				$txt .=  mb_substr($row['nickname'],0,5,'utf-8');
			}
			$txt .=  "</td>\n";
			if ($config['isrankrenshu']==0){
			$txt .=  "               <td>" . $row['commcount'] . "人</td>\n";
			}
			if ($config['isrankqianshu']==0){
			$txt .=  "               <td><span>￥" . $row['feesum'] ."</span></td>\n";
			}
			$txt .=  "           </tr>\n";
		}
	}
	$txt .=  "       </tbody></table>\n";

	$txt .=  "    </div>\n";
	$txt .=  " </div>\n";
    if ($commssum>0 && $config['ismycomm']==0 || $config['ismycomm']==1){
		$txt .=  "       <a href=\"" . $_G['siteroot'].createMobileUrl('mycomm',array('themeid'=>$themeid)) ."\" class=\"myhold\" style=\"background: #ec1f1a; margin-top: 6px;\" >我的红包<span>￥" . $commssum ."</span></a>\n";
    }
	$txt .=  "</div>\n";
	$txt2 = $txt;

	$result['phb'] = Theme::encode($txt2);
}

$myworker = Worker::getThemeWorkerByOpenid($_G['openid'],$themeid,1);

$txt =  "<div class=\"fixLeft\">\n";
if (!empty($myworker)) {
	$txt .=  "   <a href=\"" . $_G['siteroot'].createMobileUrl("w_index",array("themeid"=>$themeid)) . "\" class=\"ht\">管理</a>\n";
}
// $txt .=  "   <a href=\"javascript:void(0)\" class=\"dh\">导航</a>\n";

if (!empty($config['kfewm']) || !empty($workerqr)) {
	$txt .=  "   <a href=\"javascript:showposter()\" class=\"hb\">海报</a>\n";
}
$txt .=  "</div>\n";
$txt .=  "<div class=\"share newimg\">\n";
$txt .=  "<span class=\"closeBtn\" onclick=\"closescreen()\"></span>\n";
$txt .=  "   <div class=\"sharTit\">\n";
$txt .=  "       请长按图片，选择保存到手机<br/>\n";
$txt .=  "       把图片分享到朋友圈或好友，邀请好友参与\n";
$txt .=  "   </div>\n";
$txt .=  "   <img id=\"posterimg\" >\n";
$txt .=  "</div>\n";

$txt .=  "<div class=\"kfBox\">\n";
$txt .=  "<span class=\"closeBtn\" onclick=\"closescreen()\"></span>\n";
$txt .=  "<div class=\"kfTitle\">\n";
$txt .=  "   	客服专线：<a href=\"tel:" . $theme['mobile'] . "\">" . $theme['mobile'] . "</a>\n";
$txt .=  "   </div>\n";
if (!empty($workername)){
	$txt .=  "   <div class=\"kfNotice\">\n";
	$txt .=  "   	<p>您的专属客服：" . $workername . "</p>\n";
	$txt .=  "       <p>电话：<a href=\"tel:" . $workermobile. "\">" . $workermobile . "</a></p>\n";
	$txt .=  "   </div>\n";
}
if (!empty($config['kfewm']) || !empty($workerqr) ) {
	$txt .=  "   <div class=\"ewmBox newimg\" >\n";
	if (!empty($workerqr)) {
		$txt .=  "   	<img src=\"" . $workerqr . "\">\n";
	}else{
		$txt .=  "   	<img src=\"" . $config['kfewm'] . "\">\n";
	}
	$txt .=  "   </div>\n";
	$txt .=  "   <p>微信在线咨询</p>\n";
}
$txt .=  "</div>\n";
	$result['fixleft'] = Theme::encode($txt);




//按扭文字
if ($config['joinfee']=='0.00' && $config['groupprice']=='0.00'){
	$config['formtextcenter']= str_replace("￥#tuan", "", $config['formtextcenter']);
	$config['formtextcenter']= str_replace("￥#fee", "", $config['formtextcenter']);
	$config['formtextcenter']= str_replace("#br", "", $config['formtextcenter']);
}
	$formtextpay = Theme::ButtonTextYx2020($config['formtextpay'],$config['joinfee'],$config['primeprice'],$config['groupprice']);

	if ($system['jiage'] > 0){ 
		$formtextpay = '立即支付';
		$formtextpay1 = Theme::ButtonTextYx2020($config['formtextpay'],$config['joinfee'],0,0);
		$formtextpay2 = Theme::ButtonTextYx2020($config['formtextpay'],$config['joinfee2'],0,0);
		$formtextpay3 = Theme::ButtonTextYx2020($config['formtextpay'],$config['joinfee3'],0,0);
		$config['formtextcenter']= str_replace("￥#fee#br", "", $config['formtextcenter']);
		$config['formtextcenter2']= str_replace("￥#fee#br", "", $config['formtextcenter2']);
		$config['formtextleft']= str_replace("￥#fee#br", "", $config['formtextleft']);
		$config['isshowprice']=0;
	}
	// $config['formtextcenternew']= str_replace("￥#fee#br", "", $config['formtextcenternew']);
	// $config['formtextright']= str_replace("￥#fee#br", "", $config['formtextright']);
	 
	$formtextleft = Theme::ButtonTextYx2020($config['formtextleft'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
	$formtextcenter = Theme::ButtonTextYx2020($config['formtextcenter'],$config['joinfee'],$config['primeprice'],$config['groupprice']);

	$formtextcenter= str_replace("<i>", "", $formtextcenter);
	$formtextcenter= str_replace("</i>", "", $formtextcenter);

	$formtextcenter2 = Theme::ButtonTextYx2020($config['formtextcenter2'],$config['joinfee'],$config['primeprice'],$config['groupprice2']);
	$formtextcenternew = Theme::ButtonTextYx2020($config['formtextcenternew'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
	$formtextright = Theme::ButtonTextYx2020($config['formtextright'],$config['joinfee'],$config['primeprice'],$groupprice);

		$wtformtextpay = Theme::ButtonTextYx2020($config['wtformtextpay'],$config['joinfee'],$config['primeprice'],$config['groupprice']);	
		$wtformtextleft = Theme::ButtonTextYx2020($config['wtformtextleft'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
	if ($system['softstyle']==5) {
		$jmdibuwenzi = Theme::ButtonTextYx2020($config['jmdibuwenzi'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
		$jmzhifuwenzi = Theme::ButtonTextYx2020($config['jmzhifuwenzi'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
		$jmzhifuwenzi2 = Theme::ButtonTextYx2020($config['jmzhifuwenzi2'],$config['joinfee'],$config['primeprice'],$config['groupprice']);
	}

if (empty($themyrecordid) && !empty($showrecord)){
	$txt = "<div class=\"teamAlt\">\n";
	$txt .= " <div class=\"teamTitle\">\n";
	$txt .= "     选择参与方式\n";
	$txt .= "       <span class=\"closeB\" onclick=\"closescreen()\"></span>\n";
	$txt .= "   </div>\n";
	$txt .= "   <div class=\"peoBox\">\n";
	$txt .= "     <ul>\n";
	$txt .= "         <li><img src=\"" . tomedia($showrecord['avatar']) ."\"><span class=\"tagpeo\">拼主</span></li>\n";
	if (!empty($detaillist)){
		foreach ($detaillist as $cindexno => $item) {
		$txt .= "                     <li>\n";
		$txt .= "                         <img src=\"" . tomedia($item['avatar']) . "\">\n";
		$txt .= "                     </li>\n";
		}
	}

	if (!empty($num_arr)){
		foreach ($num_arr as $cindexno => $item) {
			$txt .= "           <li><img src=\"".$_G['URL']['YX2020_CSS']."images/usera.png\"></li>\n";
		}
	}
	$txt .= "       </ul>\n";
	$txt .= "       <div class=\"relesPeo\">\n";

	if ($nowgroupneednum!=0){
		$txt .= "          <span>此团仅剩" . $nowgroupneednum . "个名额，您现在付款即可加入此团</span>\n";
	}else{
		if ($config['tuanmode']==0){
			$txt .= "          <span>此团已团成功</span>\n";
		}else{
			$txt .= "          <span>此团已团成功,还可继续加入,共享福利</span>\n";
		}
	}

	$txt .= "       </div>\n";
	$txt .= "   </div>\n";
	$txt .= "   <div class=\"controlBtn\">\n";

	$formtextcenternew = str_replace("<h2>","",$formtextcenternew);
	$formtextcenternew = str_replace("</h2>","",$formtextcenternew);
	$formtextcenternew = str_replace("<p>","",$formtextcenternew);
	$formtextcenternew = str_replace("</p>","",$formtextcenternew);
	$formtextright = str_replace("<h2>","",$formtextright);
	$formtextright = str_replace("</h2>","",$formtextright);
	$formtextright = str_replace("<p>","",$formtextright);
	$formtextright = str_replace("</p>","",$formtextright);
	if ($nowgroupneednum!=0){
		$txt .= "     <a style=\"background: #d2d5d6; color: #656464;\" href=\"javascript:;\" onclick=\"show_info(1)\">".$formtextcenternew."</a>\n";
		$txt .= "       <a style=\"background: {$config['formcolortop']};\" href=\"javascript:;\" onclick=\"show_info(2)\">".$formtextright."</a>\n";
	}else{
		if ($config['tuanmode']==0){
			$txt .= "     <a style=\"background: {$config['formcolortop']};\" href=\"javascript:;\" onclick=\"show_info(1)\">".$formtextcenternew."</a>\n";
			$txt .= "     <a style=\"background: #d2d5d6; color: #656464;height: .95rem;\" href=\"javascript:;\" onclick=\"tips('此团已满,请开新团')\" ><h2 style=\"font-size: .28rem; line-height: .4rem; margin-top: .11rem;\">".$formtextright."</h2><p style=\"font-size: .2rem;line-height: .4rem;\">（此团已满,请开新团）</p></a>\n";
		}else{
			$txt .= "     <a style=\"background: #d2d5d6; color: #656464;\" href=\"javascript:;\" onclick=\"show_info(1)\">".$formtextcenternew."</a>\n";
			$txt .= "     <a style=\"background: {$config['formcolortop']};height: .95rem;\" href=\"javascript:;\" onclick=\"show_info(2)\" ><h2 style=\"font-size: .28rem; line-height: .4rem; margin-top: .11rem;\">".$formtextright."</h2><p style=\"font-size: .2rem;line-height: .4rem;\">（此团已团成功,还可加入）</p></a>\n";
		}

	}

	$txt .= "   </div> \n";
	$txt .= "</div>\n";

	$result['teamAlt'] = Theme::encode($txt);
}

$btnnum = 0;
if (!empty($config['buttontips'])){
	$config['buttontips'] = str_replace("#totalsum",$totalsum,$config['buttontips']);
	$config['buttontips'] = str_replace("#groupsnum",$groupsnum,$config['buttontips']);
	$config['buttontips'] = str_replace("#scansum",$scansum,$config['buttontips']);
	$txt =  "<div class=\"bottomtips\" >" . $config['buttontips'] . "</div>";
}else{
	$txt = "";
}

$txt .= "<div class=\"fixBottom\">\n";
if (!empty($config['kfewm']) || !empty($workerqr)) {
	$txt .=  "   <a href=\"tel:";
	if (empty($workermobile)) {
		$txt .= $theme['mobile'];
	}else{
		$txt .= $workermobile;
	}
	$txt .= "\" class=\"kfBtn\">\n";
	$txt .=  "       客服\n";
	$txt .=  "   </a>\n";
	$txt .=  "   <a href=\"javascript:kfBtn()\" class=\"wechatBtn\">\n";
	$txt .=  "       微信\n";
	$txt .=  "   </a>\n";
}else{
	$txt .=  "   <a href=\"javascript:kfBtn()\" class=\"kfBtn\">\n";
	$txt .=  "       客服\n";
	$txt .=  "   </a>\n";
	$txt .=  "   <a href=\"javascript:showposter()\" class=\"hb\">\n";
	$txt .=  "       海报\n";
	$txt .=  "   </a>\n";
}
$txt .=  "   <div class=\"setBtn\">\n";
if ($config['joinfee']=='0.00' && $config['groupprice']=='0.00'){
	// echo $config['joinfee'] ."==" . $config['groupprice'] .$formtextcenter;
	$btnnum = $btnnum + 1;
	if (empty($themyrecordid)){
		$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(1)\" class=\"teamBtn dh3\">\n";
		if (strstr($config['formtextcenter'],"#br")==false ) {
			// $formtextcenter = str_replace("<span>", "<span style=\"font-size:18px;\">", $formtextcenter) ;
		}else{
			if ($btnnum==1) {
				$formtextcenter = str_replace("<h2>", "<p>", $formtextcenter) ;
				$formtextcenter = str_replace("</h2><p>", "", $formtextcenter) ;
			}
		}
		$txt .= $formtextcenter;
		$txt .= "     </a>\n";
	}else{
		$txt .= "     <a href=\"javascript:;\" class=\"teamBtn dh3\">\n<p>";
		$txt .= str_replace("组团", "报名", $config['lablesuccess']) ;;
		$txt .= "     </p></a>\n";
	}
}else{
	// echo $config['joinfee'] ."==" . $config['groupprice'];
	if (empty($themyrecordid)){
		if ($config['primeprice']!='0.00' && $config['formtextleftopen']!=1){
			$btnnum = $btnnum + 1;
			$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(3)\" class=\"dh1\">\n";
			$txt .= $formtextleft;
			// $txt .= "       <p><i>￥</i>39.90</p>\n";
			// $txt .= "         <span>原价购买</span>\n";
			$txt .= "     </a>\n";
		}
		if (empty($showrecord)){
			if ($config['groupprice2']!='0.00'){
				$btnnum = $btnnum + 2;
				$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(1)\" class=\"teamBtn dh2\">\n";
				$txt .= $formtextcenter;
				$txt .= "     </a>\n";
				$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(4)\" class=\"teamBtn dh3\">\n";
				$txt .= $formtextcenter2;
				$txt .= "     </a>\n";
			}else{
				$btnnum = $btnnum + 1;
				$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(1)\" class=\"teamBtn dh3\">\n";
				if ($btnnum==1) {
					$formtextcenter = str_replace("<h2>", "<p>", $formtextcenter) ;
					$formtextcenter = str_replace("</h2><p>", "", $formtextcenter) ;
				}
				$txt .= $formtextcenter;
				$txt .= "     </a>\n";
			}
		}elseif ($config['groupprice2']!='0.00'){
			$btnnum = $btnnum + 2;
			$txt .= "     <a href=\"javascript:;\" onclick=\"";
			$txt .= "swithmenu()";
			$txt .= "\" class=\"teamBtn dh2\">\n";
			$txt .= $formtextcenternew;
			$txt .= "     </a>\n";

			$txt .= "     <a href=\"javascript:;\" onclick=\"show_info(2)\" class=\"teamBtn dh3\">\n";
			$txt .= $formtextright;
			$txt .= "     </a>\n";
		}else{
			$btnnum = $btnnum + 1;
			$txt .= "     <a href=\"javascript:;\" onclick=\"show_tuan()\" class=\"teamBtn dh3\">\n";
			if ($btnnum==1) {
				$formtextcenter = str_replace("<h2>", "<p>", $formtextcenter) ;
				$formtextcenter = str_replace("</h2><p>", "", $formtextcenter) ;
			}
			$txt .= $formtextcenter;
			$txt .= "     </a>\n";
		}
	}else{
		//若开启补余款
		if ($config['yukuan']>0 && TIMESTAMP>$config['yukuantime']){
			$orderpay = db_fetchcolumn ( 'SELECT sum(realfee) FROM ' . tablename ( t_order ) . "
				WHERE themeid = '{$themeid}' and paystate = 1 and realfee > 0 and uid='{$_G['member']['uid']}'" );
			$orderpay = sprintf("%.2f",$config['yukuan'] - $orderpay);
			if ($orderpay>0) {				
				$btnnum = $btnnum + 1;
				$txt .= "     <a href=\"javascript:;\" onclick=\"topayyukuan()\" class=\"dh1\">\n";
				$txt .= "<p>立即补余款" . $orderpay . "元</p>";
				$txt .= "     </a>\n";
			}else{				
				$btnnum = $btnnum + 1;
				$txt .= "     <a href=\"javascript:;\" onclick=\"letgo1()\" class=\"dh1\">\n<p>";
				$txt .= $config['lablegspy'];
				$txt .= "</p>     </a>\n";
			}
		}else{
			$btnnum = $btnnum + 2;
			if ($config['maxcount']>0){
				$txt .= "     <a href=\"";
				if ($config['ishexiao']==1){
					$txt .= $_G['siteroot'].createMobileUrl("myorder",array("themeid"=>$themeid));
				}else{
					$txt .= $_G['siteroot'].createMobileUrl("mypay",array("themeid"=>$themeid));
				}
				$txt .= "\"  class=\"teamBtn dh1\">";
				if ($themyrecord['type']==9){
					$txt .= "<h2>单买号:" . $themyrecordid ."</h2><p>&#28857;击查看我的定单</p>";
				}else{
					$txt .= "<h2>&#22242号:" . $themyrecordid ."</h2><p>&#28857;击查看我的定单</p>";
				}
				$txt .= "</a>\n";

			}else{
				$txt .= "     <a href=\"";
				if ($config['ishexiao']==1){
					$txt .= $_G['siteroot'].createMobileUrl("myorder",array("themeid"=>$themeid));
				}else{
					$txt .= $_G['siteroot'].createMobileUrl("mypay",array("themeid"=>$themeid));
				}
				$txt .= "\" class=\"teamBtn dh2\">\n";
				$txt .= "       <h2>定单号:" . $themyrecordid . "</h2>\n";
				$txt .= "         <p>点击查看我的定单</p>\n";
				$txt .= "     </a>\n";
			}
			$txt .= "     <a href=\"javascript:;\" onclick=\"letgo1()\" class=\"teamBtn dh3\">\n<p>";
			if ($themyrecord['type']!=9 && $config['maxcount']>0){
				$txt .= $config['lableleadergs'];
			}else{
				$txt .= $config['lablegspy'];
			}
			$txt .= "</p></a>\n";
		}
	}
}
	$txt .= " </div>\n";
	$txt .= " </div>\n";

	// $txt .= " <div class=\"inforBox\">\n";
	// $txt .= "   <div class=\"inforTit\">\n";
	// $txt .= "     <h2>联系方式</h2>\n";
	// $txt .= "     <div class=\"peopleNum\">\n";
	// $txt .= "       <p>报名人数:565</p>\n";
	// $txt .= "       <span>浏览量:4525</span> </div>\n";
	// $txt .= "   </div>\n";
	// $txt .= "   <div class=\"inforForm\">\n";
	// $txt .= "     <ul>\n";
	// $txt .= "       <li>\n";
	// $txt .= "         <p class=\"name\">姓名</p>\n";
	// $txt .= "         <input type=\"text\" placeholder=\"请输入名称\">\n";
	// $txt .= "       </li>\n";
	// $txt .= "       <li>\n";
	// $txt .= "         <p class=\"phone\">电话</p>\n";
	// $txt .= "         <input type=\"text\" placeholder=\"请输入联系方式\">\n";
	// $txt .= "       </li>\n";
	// $txt .= "       <li>\n";
	// $txt .= "         <p class=\"selec\">下拉选择</p>\n";
	// $txt .= "         <select>\n";
	// $txt .= "           <option>选择内容</option>\n";
	// $txt .= "           <option>选择内容</option>\n";
	// $txt .= "           <option>选择内容</option>\n";
	// $txt .= "         </select>\n";
	// $txt .= "       </li>\n";
	// $txt .= "       <li>\n";
	// $txt .= "         <p class=\"checkBo\">单选</p>\n";
	// $txt .= "         <div class=\"choseBar\"> <span class=\"cur\">选项1</span> <span>选项2</span> </div>\n";
	// $txt .= "       </li>\n";
	// $txt .= "       <li>\n";
	// $txt .= "         <p class=\"dateChose\">日期</p>\n";
	// $txt .= "         <input type=\"date\">\n";
	// $txt .= "       </li>\n";
	// $txt .= "     </ul>\n";
	// $txt .= "   </div>\n";
	// $txt .= "   <a href=\"\" class=\"suer\">确 定</a> </div>\n";
	// $txt .= " <div class=\"choseBtn\"> 请选择礼品 </div>\n";
	// $txt .= " <div class=\"h44\"></div>\n";


$txt .=  "<div class=\"inforBox\" id=\"inforBox\">\n";
$txt .=  "<span class=\"closeBtn\" onclick=\"closescreen()\"></span>\n";
$txt .=  "   <div class=\"inforTit\">\n";
if (!empty($workername)){
	$txt .=  "       <a href=\"tel:" . $workermobile ."\"><h2>客服：" . $workername ."</h2></a>\n";
}else{
	$txt .=  "       <h2>联系方式</h2>\n";
}
$txt .=  "       <div class=\"peopleNum\">\n";
if ($config['iswttouxiang']==1){
	$txt .=  "           <p>&nbsp</p>\n";
}else{
	$txt .=  "           <p>报名人数:" . $totalsum . "</p>\n";
}
$txt .=  "           <span>浏览量:" . $scannum . "</span>\n";

	// if ($config['maxcount']==0) {
	// 	$txt .=  "           <p>报名人数:" . $totalsum . "</p>\n";
	// 	$txt .=  "           <span>浏览量:" . $scannum . "</span>\n";
	// }else{
	// 	$txt .=  "           <p>已有" . $totalsum . "人参团</p>\n";
	// 	$txt .=  "           <span>共" . $scannum . "个团</span>\n";
	// }

$txt .=  "       </div>\n";
$txt .=  "   </div>\n";
$txt .=  "   <div class=\"inforForm\">\n";
$txt .=  "       <ul>\n";
$txt .=  "           <li>\n";
$txt .=  "               <p class=\"name\">"  . $config['nametext'] . "</p>\n";
$txt .=  "               <input type=\"text\" name=\"regname_order\" id=\"regname_order\" placeholder=\"请输入"  . $config['nametext'] . "\"  value=\"" . $_G['member']['username'] ."\">\n";
$txt .=  "           </li>\n";
$txt .=  "           <li>\n";
$txt .=  "               <p class=\"phone\">"  . $config['mobiletext'] . "</p>\n";
$txt .=  "               <input type=\"text\" name=\"username_order\" id=\"username_order\" placeholder=\"请输入"  . $config['mobiletext'] . "\" value=\"" . $_G['member']['mobile'] . "\">\n";
$txt .=  "           </li>\n";
$txt .= "<input value=\"0\" type=\"hidden\" name=\"check_type\" id=\"check_type\"\n>";
$txt .= "<input value=\"0\" type=\"hidden\" name=\"joininfoid\" id=\"joininfoid\"\n>";

// if (!empty($config['address'])){
// $txt .=  "           <li>\n";
// $txt .=  "               <p class=\"selec\">"  . $config['address'] . "</p>\n";
// $txt .=  "               <input type=\"text\" placeholder=\"请输入"  . $config['address'] . "\" name=\"address_order\" value=\"" . $member['address'] ."\" id=\"address_order\">\n";
// $txt .=  "           </li>\n";
// }

if ($config['addresstype'] == 2) {
	if (!empty($config['address']) && !empty($config['addressoptions'])){
		$txt .= "       <li>\n";
		$txt .= "         <p class=\"selec\">" . $config['address'] ."</p>\n";
		$txt .= "         <select id=\"address\" name=\"address\" >\n";
		$txt .= "           <option value=\"\">请选择" . $config['address'] ."</option>\n";
		foreach ($config['addressoptions'] as $row) {
			$txt .= "           <option value=\"" . $row ."\"";
			if ($row==$member['address']){
				$txt .= "selected=\"selected\"";
			}
			$txt .= ">" . $row . "</option>\n";
		}
		$txt .= "         </select>\n";
		$txt .= "       </li>\n";
	}else{
		$txt .= "<input  type=\"hidden\" name=\"address\" value=\"默认\" id=\"address\">";
	}
}elseif (!empty($config['address']) && ($config['addresstype'] == 0 || $config['addresstype'] == 1)) {
	$txt .= "             <li><p class=\"selec\">" . $config['address'] . "</p><input type=\"";
	if ($config['addresstype']=='1'){
		$txt .=  "tel";
	}else{
		$txt .= "text";
	}
	$txt .= "\" name=\"address\" value=\"" . $member['address'] ."\" id=\"address\" placeholder=\"请输入" . $config['address'] . "\"></li>\n";
}


if ($config['shopstype'] == 0) {
	if (!empty($config['shops']) && !empty($config['options'])){
		$txt .= "       <li>\n";
		$txt .= "         <p class=\"selec\">" . $config['shops'] ."</p>\n";
		$txt .= "         <select id=\"shoptitle\" name=\"shoptitle\" >\n";
		$txt .= "           <option value=\"\">请选择" . $config['shops'] ."</option>\n";
		foreach ($config['options'] as $row) {
			$txt .= "           <option value=\"" . $row ."\"";
			if ($row==$member['option']){
				$txt .= "selected=\"selected\"";
			}
			$txt .= ">" . $row . "</option>\n";
		}
		$txt .= "         </select>\n";
		$txt .= "       </li>\n";
	}else{
		$txt .= "<input  type=\"hidden\" name=\"shoptitle\" value=\"默认\" id=\"shoptitle\">";
	}
}elseif ($config['shopstype'] == 3) {
	if (!empty($config['shops']) && !empty($config['options'])){
		$txt .= "       <li>\n";
		$txt .= "         <p class=\"checkBo\">" . $config['shops'] ."</p>\n";
		$txt .= "         <div class=\"choseBar\"> ";
		foreach ($config['options'] as $index=>$row) {
			$txt .= "<span id = \"choseBar" .$index."\" onclick=\"choseBar(".$index.")\"";
			if ($row==$member['option']){
				$txt .= " class=\"cur\"";
			}
			$txt .= ">" . $row . "&nbsp;&nbsp;&nbsp;</span>";
		}
		$txt .= " </div>\n";
		$txt .= "       </li>\n";
	}else{
		$txt .= "<input  type=\"hidden\" name=\"shoptitle\" value=\"默认\" id=\"shoptitle\">";
	}
}elseif ($config['shopstype'] == 1 || $config['shopstype'] == 2) {
	$txt .= "             <li><p class=\"selec\">" . $config['shops'] . "</p><input type=\"";
	if ($config['shopstype']=='2'){
		$txt .=  "tel";
	}else{
		$txt .= "text";
	}
	$txt .= "\" name=\"shoptitle\" value=\"" . $member['option'] ."\" id=\"shoptitle\" placeholder=\"请输入" . $config['shops'] . "\"></li>\n";
}


if (!empty($config['datetime'])){
	if ($config['datetimetype'] > 0){
		$txt .= "             <li><p class=\"selec\">" . $config['datetime'] . "</p><input type=\"";
		if ($config['datetimetype']=='2'){
			$txt .=  "tel";
		}else{
			$txt .= "text";
		}
		$txt .= "\" name=\"date_order\" value=\"{$member['datetime']}\" id=\"date_order\" placeholder=\"请输入" . $config['datetime'] . "\"></li>\n";
	}else{
		$txt .= "       <li>\n";
		$txt .=  "        <p class=\"dateChose\">" . $config['datetime'] . "</p>\n";
		$txt .= "         <input type=\"date\"  value=\"" . $member['datetime'] . "\" name=\"date_order\" id=\"date_order\">\n";
		$txt .= "       </li>\n";
	}
}

$txt .=  "       </ul>\n";
$txt .=  "   </div>\n";
$txt .=  "   <a href=\"javascript:;\" onclick=\"topaynew()\" class=\"suer\">";
	if ($system['ruanjian']==1) {
		if ($config['joinfee']=='0.00'){
			$txt .=  $wtformtextleft;
		}else{
			$txt .=  $wtformtextpay;
		}
	}else{
		if ($config['yukuan']>0 && TIMESTAMP>$config['yukuantime']){
			$txt .=  "立即支付";
		}elseif ($config['joinfee']=='0.00' && $config['groupprice']=='0.00'){
			$txt .=  $formtextcenter;
		}elseif ($config['joinfee']=='0.00'){
			$txt .=  "点击支付报名费";
		}else{
			$txt .=  $formtextpay;
		}
	}
	$txt .= "</a>\n";
$txt .=  "</div>\n";


//提交信息
if ($config['isicon']>0 && $config['iconziliao']==0){
	$txt .=  "<div class=\"inforBox\" id='shareinfo'>\n";
	$txt .=  "<span class=\"closeBtn\" onclick=\"closescreen()\"></span>\n";
	$txt .=  "   <div class=\"inforTit\">\n";
	if (!empty($workername)){
		$txt .=  "       <a href=\"tel:" . $workermobile ."\"><h2>客服：" . $workername ."</h2></a>\n";
	}else{
		$txt .=  "       <h2>联系方式</h2>\n";
	}
	$txt .=  "       <div class=\"peopleNum\">\n";
	if ($config['iswttouxiang']==1){
		$txt .=  "           <p>&nbsp</p>\n";
	}else{
		$txt .=  "           <p>报名人数:" . $totalsum . "</p>\n";
	}
	$txt .=  "           <span>浏览量:" . $scannum . "</span>\n";

	$txt .=  "       </div>\n";
	$txt .=  "   </div>\n";
	$txt .=  "   <div class=\"inforForm\">\n";
	$txt .=  "       <ul>\n";
	$txt .=  "           <li>\n";
	$txt .=  "               <p class=\"name\">"  . $config['nametext'] . "</p>\n";
	$txt .=  "               <input type=\"text\" name=\"username_share\" id=\"username_share\" placeholder=\"请输入"  . $config['nametext'] . "\"  value=\"" . $_G['member']['username'] ."\">\n";
	$txt .=  "           </li>\n";
	$txt .=  "           <li>\n";
	$txt .=  "               <p class=\"phone\">"  . $config['mobiletext'] . "</p>\n";
	$txt .=  "               <input type=\"text\" name=\"mobile_share\" id=\"mobile_share\" placeholder=\"请输入"  . $config['mobiletext'] . "\" value=\"" . $_G['member']['mobile'] . "\">\n";
	$txt .=  "           </li>\n";
	$txt .=  "       </ul>\n";
	$txt .=  "   </div>\n";
	$txt .=  "   <a href=\"javascript:;\" onclick=\"save_shareinfo()\" class=\"suer\">";
	$txt .=  "提交信息";
	$txt .= "</a>\n";
	$txt .=  "</div>\n";
}

$txt1 = $txt;

	$txt .= " <div class=\"altBar\">\n";
	$txt .= "  <div class=\"slideBox\">\n";
	$txt .= "      <span href=\"javascript:;\" onclick=\"closeBtn()\" class=\"closeBtn\"></span>\n";
	$txt .= "         <div class=\"slideTit\">\n";
	$txt .= "          <a href=\"javascript:showkefu()\"></a>\n";
	// if ($config['maxcount']==0) {
		$txt .= "             <span>已有<i>" . $totalsum . "</i>人报名/浏览量<i>" . $scannum . "</i></span>\n";
	// }else{
	// 	$txt .= "             <span>已有<i>" . $totalsum . "</i>参团/共<i>" . $groupsnum . "</i>个团</span>\n";
	// }
	$txt .= "         </div>\n";


if ($config['maxcount']>0) {
	$txt .= "         <div class=\"slideList levelgroup_head\">\n";
	$txt .= "          <div class=\"pin\" style=\"background:none;\">\n";
	$txt .= "                 <ul>\n";
	$txt .= "                     <li>\n";
	$txt .= "                         <img src=\"" . tomedia($showrecord['avatar']) ."\">\n";
	$txt .= "                         <span class=\"homez\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/homez.png \"></span>\n";
	$txt .= "                     </li>\n";

	if (!empty($detaillist)){
		foreach ($detaillist as $cindexno => $item) {
		$txt .= "                     <li>\n";
		$txt .= "                         <img src=\"" . tomedia($item['avatar']) . "\">\n";
		if ($cindexno==0){
			$txt .= "                         <span class=\"bbsoft\"><img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/soft.png\"></span>\n";
		}
		$txt .= "                     </li>\n";
	    
		}
    }
	if (!empty($num_arr)){
		foreach ($num_arr as $cindexno => $item) {
		$txt .= "                     <li>\n";
		$txt .= "                         <img src=\"" . $_G['URL']['FCPDD_CSS'] . "images/ask.png\">\n";
		$txt .= "                     </li>\n";
	    
		}
    }
	$txt .= "                 </ul>\n";
	$txt .= "               </div>\n";
	$txt .= "         </div>\n";
	$txt .= "         <div class=\"noticeLi levelgroup_num\">\n";
	if ($nowgroupneednum!=0){
		$txt .= "          — 此团仅剩" . $nowgroupneednum . "个名额，您现在付款即可加入此团 —\n";

	}else{
		if ($config['maxcountall']>1){
			if ($config['tuanmode']==0){
				$txt .= "          — 此团已团成功 —\n";
			}else{
				$txt .= "          — 此团已团成功,还可继续加入,共享福利 —\n";
			}
		}
	}
	$txt .= "         </div>\n";

}

	$txt .= "         <div class=\"lable mantuan\" ><button onclick=\"closeBtn()\" type=\"submit\" class=\"subEnt\"> <span>此团已满团，返回开新团</span> </button>";
	$txt .= "         </div>\n";

	$txt .= "         <div class=\"lable weimantuan\">\n";
	$txt .= "             <div class=\"inforForm\">\n";
	$txt .= "     <ul>\n";



$txt .= "          <li><span>" . $config['nametext'] . "</span><input type=\"text\" placeholder=\"请输入" . $config['nametext'] . "\" name=\"regname_order\" id=\"regname_order\" value=\"" . $_G['member']['username'] ."\"></li>\n";
$txt .= "             <li><span>" . $config['mobiletext'] . "</span><input type=\"tel\" placeholder=\"请输入" . $config['mobiletext'] . "\" name=\"username_order\" id=\"username_order\" value=\"" . $_G['member']['mobile'] . "\"></li>\n";
$txt .= "<input value=\"0\" type=\"hidden\" name=\"check_type\" id=\"check_type\"\n>";
$txt .= "<input value=\"0\" type=\"hidden\" name=\"joininfoid\" id=\"joininfoid\"\n>";

if ($config['shopstype'] == 1 || $config['shopstype'] == 2) {
	$txt .= "             <li><span>" . $config['shops'] . "</span><input type=\"";
	if ($config['shopstype']=='2'){
		$txt .=  "tel";
	}else{
		$txt .= "text";
	}
	$txt .= "\" name=\"shoptitle\" value=\"" . $member['option'] ."\" id=\"shoptitle\" placeholder=\"请输入" . $config['shops'] . "\"></li>\n";
}

if (!empty($config['address'])){
	$txt .= "             <li><span>" . $config['address'] . "</span><input type=\"text\" name=\"address_order\" value=\"" . $member['address'] ."\" id=\"address_order\" placeholder=\"请输入" . $config['address'] . "\"></li>\n";
}
if (!empty($config['datetime'])){
	if ($config['datetimetype'] > 0){
		$txt .= "             <li><span>" . $config['datetime'] . "</span><input type=\"";
		if ($config['datetimetype']=='2'){
			$txt .=  "tel";
		}else{
			$txt .= "text";
		}
		$txt .= "\" name=\"date_order\" value=\"{$member['datetime']}\" id=\"date_order\" placeholder=\"请输入" . $config['datetime'] . "\"></li>\n";
	}else{
		$txt .= "       <li id=\"datainp\">\n";
		$txt .= "         <span>" . $config['datetime'] . "</span>\n";
		$txt .= "         <input type=\"date\" style=\"width:260px;\"  value=\"" . $member['datetime'] . "\" name=\"date_order\" id=\"date_order\">\n";
		$txt .= "       </li>\n";
	}
}
	// $txt .= "       <li>\n";
	// $txt .= "         <span>单&nbsp;&nbsp;&nbsp;&nbsp;选</span>\n";
	// $txt .= "         <div class=\"choseBar\"> <span class=\"cur\">选项1</span> <span>选项2</span> </div>\n";
	// $txt .= "       </li>\n";
	$txt .= "     </ul>\n";
	$txt .= "   </div>\n";
	$txt .= "             <button id=\"topay\" onclick=\"topaynew()\" type=\"submit\" class=\"subEnt\"> ";
	if ($system['ruanjian']==1) {
		if ($config['joinfee']=='0.00'){
			$txt .=  $wtformtextleft;
		}else{
			$txt .=  $wtformtextpay;
		}
	}else{
		if ($config['joinfee']=='0.00'){
			$txt .=  "点击支付报名费";
		}else{
			$txt .=  $formtextpay;
		}
	}
	$txt .= " </button>\n";
	$txt .= "         </div>\n";
	$txt .= "     </div>\n";
	$txt .= " </div>\n";
  

$result['footmenu'] = Theme::encode($txt1);
$result['btnnum'] = $btnnum;

$result['errcode'] = 0;
return_msg($result, '', 'ajax');
}
}